//
//  UIImage+Context.m
//  Wb_oc
//
//  Created by wzz on 16/7/28.
//  Copyright © 2016年 wzz. All rights reserved.
//

#import "UIImage+Context.h"

@implementation UIImage (Context)

+ (UIImage *)getScreenShot{
    // 得到windows
    UIWindow * windows = [[UIApplication sharedApplication] keyWindow];
    // 01开启上下文
    UIGraphicsBeginImageContext(windows.bounds.size);
    // 02当windows渲染到上下文中
    [windows drawViewHierarchyInRect:[UIScreen mainScreen].bounds afterScreenUpdates:false];
    // 03从上下文中获取image
    UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
    // 04关闭上下文
    UIGraphicsEndImageContext();
    
    return image;
}
@end
